<?php
namespace app\api\controller\xykeep;
use app\common\controller\Api;
use app\admin\model\xykeep\Feedback as FeedbackModel;

/**
 * 用户反馈
 */
class Feedback extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];

    /*
     * 意见反馈
     */
    public function submit()
    {
        $params = $this->request->post();

        if(mb_strlen($params['question'], 'utf8')>300){
            $this->error('反馈原因超出字数限制', mb_strlen($params['question'], 'utf8'));
        }
        $res = FeedbackModel::create([
            'type' => xykeepFilterSql($params['feedback']),
            'content' => xykeepFilterSql($params['question']),
            'user_id' => $this->auth->id
        ]);
        $this->success('提交成功',$res);
    }

}